﻿@model GH.Northwind.Business.Entities.Product           
@{    
    
    SelectList suppliers = @ViewBag.SuppliersCategoriesModel.Suppliers;
    SelectList categories = @ViewBag.SuppliersCategoriesModel.Categories;                
}         

@{
    ViewBag.Title = "CreateProduct";
    Layout = "~/Views/Shared/_Layout.cshtml";
}

<h2>CreateProduct</h2>

<script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script>

@using (Html.BeginForm())
{
    @Html.ValidationSummary(true)
    <fieldset>
        <legend>Product</legend>

        <div class="editor-label">
            @Html.LabelFor(model => model.ProductName)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.ProductName)
            @Html.ValidationMessageFor(model => model.ProductName)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.SupplierID)
        </div>
        <div class="editor-field">
            @Html.DropDownListFor(model => model.SupplierID, suppliers)
            @Html.ValidationMessageFor(model => model.SupplierID)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.CategoryID)
        </div>
        <div class="editor-field">
            @Html.DropDownListFor(model => model.CategoryID, categories)
            @Html.ValidationMessageFor(model => model.CategoryID)
            
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.QuantityPerUnit)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.QuantityPerUnit)
            @Html.ValidationMessageFor(model => model.QuantityPerUnit)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.UnitPrice)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.UnitPrice)
            @Html.ValidationMessageFor(model => model.UnitPrice)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.UnitsInStock)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.UnitsInStock)
            @Html.ValidationMessageFor(model => model.UnitsInStock)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.UnitsOnOrder)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.UnitsOnOrder)
            @Html.ValidationMessageFor(model => model.UnitsOnOrder)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.ReorderLevel)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.ReorderLevel)
            @Html.ValidationMessageFor(model => model.ReorderLevel)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.Discontinued)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.Discontinued)
            @Html.ValidationMessageFor(model => model.Discontinued)
        </div>

         <div class="createEditInput">
            <input type="submit" value="Create" />
         </div>
        
    </fieldset>
}

<div>
    @Html.ActionLink("Back to List", "AllProducts")
</div>

